package com.zxk.util;

import java.time.LocalDateTime;

/**
 * 时间工具
 *
 * @author: 舟小亢
 * @date: 2023-08-31 0:08
 */
public class TimeUtil {

    /**
     * 判断当前时间区间
     *
     * @param start
     * @param end
     * @return
     */
    public static boolean between(int start, int end) {
        LocalDateTime now = LocalDateTime.now();
        return now.getHour() >= start && now.getHour() <= end;
    }

    /**
     * 在指定时间之后
     *
     * @param hour
     * @param minute
     * @return
     */
    public static boolean isAfter(int hour, int minute) {
        LocalDateTime now = LocalDateTime.now();
        return now.getHour() >= hour && now.getMinute() >= minute;
    }

    /**
     * 在指定时间之前
     *
     * @param hour
     * @param minute
     * @return
     */
    public static boolean isBefore(int hour, int minute) {
        LocalDateTime now = LocalDateTime.now();
        return now.getHour() <= hour && now.getMinute() <= minute;
    }
}
